package com.bamboo.tool.enums;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharPool;
import lombok.Getter;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;

/**
 * @author bamboo
 * Date 2022/10/19 12:59
 * Description
 */
@Getter
public enum DataType {

    INT32("int32", true,new Random().nextInt() ),
    INT64("int64", true, new Random().nextLong()),
    INT16("int16", true,new Random().nextInt(10) ),
    INT8("int8", true,1),
    CHAR("char", true, CharPool.DOT),
    STRING("string", true,""),
    BOOLEAN("boolean", true,false),
    FLOAT("float", true, new Random().nextFloat()),
    VOID("void", true,null),
    BIGDECIMAL("bigDecimal", true, BigDecimal.ZERO),
    DOUBLE("double", true, new Random().nextDouble()),
    DATE("date", true, DateUtil.now()),
    OBJECT("object", true,null),
    LIST("list", false,new ArrayList<>()),
    ARRAY("array", false,new ArrayList<>()),
    SET("set", false,new HashSet<>()),

    FILE("file", true,null),
    MAP("map", true,new HashMap<>()),
    METHOD_PARAMETER_IGNORED("method_parameter_ignored", false,null),
    FIELD_IGNORED_CLASS("field_ignored_class", false,null),
    ;

    private String code;
    private boolean isReturn;

    private Object defaultValue;

    DataType(String code, boolean isReturn, Object defaultValue) {
        this.code = code;
        this.isReturn = isReturn;
        this.defaultValue = defaultValue;
    }

}
